package sctu.edu.java.year2016.team05.lizixin.day20160614.LianXi7;

/**
 * Created by home on 2016/6/14.
 * 12.5
 */

import sctu.edu.java.year2016.team02.wanggaowen.Pra.Fil;

import java.io.*;

public class Student {
    public static void main(String[] args) {


        String content[] = {"明日科技", "java部", "快速入门"};
        File file = new File("D:/work.txt");
        try {
            FileWriter fw = new FileWriter(file);
            BufferedWriter bufw = new BufferedWriter(fw);
            for (int k = 0; k < content.length; k++) {
                bufw.write(content[k]);
                bufw.newLine();
            }
            bufw.close();
            fw.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            FileReader fr = new FileReader(file);
            BufferedReader bufr = new BufferedReader(fr);
            String s = null;
            int i = 0;
            while ((s = bufr.readLine()) != null) {
                i++;
                System.out.println("第" + i + "行" + s);
            }
            bufr.close();
            fr.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}